#!/bin/bash
#check env
if [ -z "${JAVA_HOME}" ];then
    echo "JAVA_HOME not set. eg.[export JAVA_HOME=/phd/bin/jdk]"
    exit -1
fi

#eg: export JAVA_OPTS='-server -Dfile.encoding=utf-8'
export JAVA_OPTS='' 

#common variable
APP_HOME=$(cd `dirname $0`; cd ..; pwd)
cd ${APP_HOME}

#loop classpath libraries
APP_CP=.:${APP_HOME}/lib/*

${JAVA_HOME}/bin/java ${JAVA_OPTS} -cp ${APP_CP} {{mainClass}} $*